Skip to content

4638 Improve URL formatting#695

Merged
JonJagger merged 2 commits into
mainfrom
4638-url-formatting
Mar 11, 2026
Merged

4638 Improve URL formatting#695
JonJagger merged 2 commits into
mainfrom
4638-url-formatting

Conversation

@FayeSGW

@FayeSGW FayeSGW commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

This PR implements the url package to format the URLS throughout the CLI code.

@FayeSGW

FayeSGW commented Mar 11, 2026

Copy link
Copy Markdown
Contributor Author

Note that there are a couple of places where we still use fmt to construct the URL. In these cases the URLs are static, or the only dynamic portion is inside the host (rather than the path), which the url package does not encode (and therefore we get no benefit from using the package to format these URLs).

@JonJagger JonJagger merged commit 03ac21f into main Mar 11, 2026
10 checks passed
@JonJagger JonJagger deleted the 4638-url-formatting branch March 11, 2026 12:33
dangrondahl added a commit that referenced this pull request May 29, 2026
Four commands still built URLs with fmt.Sprintf("%s/api/v2/...",
global.Host, ...), producing double-slash URLs and 404s when --host
or KOSLI_HOST had a trailing slash. Switch to url.JoinPath with
url.Values for query params, matching the pattern adopted in #695.

Affected commands: list artifacts, list approvals, list snapshots,
diff snapshots.
dangrondahl added a commit that referenced this pull request May 29, 2026
* fix: use url.JoinPath for list/diff command URLs (#913)

Four commands still built URLs with fmt.Sprintf("%s/api/v2/...",
global.Host, ...), producing double-slash URLs and 404s when --host
or KOSLI_HOST had a trailing slash. Switch to url.JoinPath with
url.Values for query params, matching the pattern adopted in #695.

Affected commands: list artifacts, list approvals, list snapshots,
diff snapshots.

* refactor: use strconv for query-param conversion

Align list/diff URL construction with the codebase convention
(logEnvironment.go, listTrails.go) by using strconv.Itoa /
strconv.FormatBool instead of fmt.Sprintf for int/bool query
parameters. Cosmetic; no behavior change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants